
1 ##################### DATA ##########################

1.1. ##### CSV data directory

the .csv files have been created using ArcGIS 10.4.1.
 
The source of raw data are all available in table 1A (supplementary materials).

all the shapefiles and rasters were transformed in Geographic Coordinate System �South American Datum 1969� and projected into �UTM Zone 18S (meters)� and clipped with a shapefile of the brazilian amazon.

A random shapefile of points has been created to cover the entire brazilian amazon (point_1km.csv)

For the data in raster format (slope, elevation, temperature, rainfalls, agricultural fires, nightlights, GFC tree cover loss, TMF tree cover loss), we have extracted the value of the raster to the point (VTP1km.csv files)

For the data in vector format (PADDD, PAs, administrative frontiers, rivers, roads), we have computed nearest distance of the point to the nearest feature (d1km.csv files), or intersections (sec1km.csv files)


1.2. ###### data.do 

- import the .csv files, clean and merge them all to create the final database in cross-section format : cross_section.dta

- clean the data and generate variables : PADDD_impact.dta



2 ################# MATCHING #####################

2.1. ##### main analysis: matching.do

uses PADDD_impact.dta, prepare the dataset, and run the main matching analysis.

pstest is used to describe how matching improves balances (tables 2A, 2B, and 2C - supplementary materials) 

mhbounds is used to obtain rosenbaum bounds for significant ATT in Rond�nia (table 2D - supplementary materials)  

Results are saved in results_impact.dta


2.2. ##### robustness checks:  matching_BZ10.do (exclusion of a 10km instead of a 20km buffer zone from the treated and control groups)

uses PADDD_impact.dta, prepare the dataset, and run the matching analysis

pstest is used to describe how matching improves balances (tables 3A-1, 3B-1, and 3C-1 - supplementary materials) 

Results are saved in results_impact_BZ10.dta


2.3  ##### robustness checks: matching_TMF.do  (TMF instead of GFC deforestation data) 

uses PADDD_impact.dta, prepare the dataset, and run the matching analysis..

pstest is used to describe how matching improves balances (tables 4A-1, 4B-1, and 4C-1 - supplementary materials)  

Results are saved in results_impact_TMF.dta



3 ##################### DID ##########################

3.1. ##### main analysis: DID_GFC.do

- reshape step by step all data from PADDD_impact.dta: DID_GFC.dta

- redefine all treatment and control variables: DID_BZ20km_GFC.dta 

- add matching results from results_impact.dta: DIDmatching_BZ20km_GFC.dta

- run TWFE (table 1A, 1B and 1C - manuscript), run DIDL (De Chaisemartin and d'Haultefoeuille, 2020) (figure 8A, 8B, 8C - manuscript)


3.2. ##### robustness checks exlucing a 10km BZ: DID_GFC_BZ10.do

- use DID_GFC.dta 

- redefine all treatment and control variables: DID_BZ10km_GFC.dta 

- add matching results from results_impact_BZ10.dta: DIDmatching_BZ10km_GFC.dta

- run TWFE (tables 3A-2, 3B-2 and 3C-2 - supplementary materials), run DIDL (figures 3A-3, 3B-3 and 3C-3 - supplementary materials)


3.3. ##### robustness checks using new TMF deforestation data: DID_TMF.do

- reshape step by step all data from PADDD_impact.dta: DID_TMF.dta

- redefine all treatment and control variables: DID_TMF.dta

- add matching results from results_impact_TMF.dta: DIDmatching_TMF.dta

- run TWFE (tables 4A-2, 4B-2 and 4C-2 - manuscript), run DIDL (figures 4A-3, 4B-3 and 4C-3 - supplementary materials)

4 ####################### FECT.R #########################

4.1. ###### main analysis: FECT.R

generates main parallel trend tests from FEct (Liu et al., 2021)  (figures 7A, 7B and 7C  - manuscript) using DIDmatching_BZ20m_GFC.dta


4.2. ###### robustness checks exluding a 10km BZ: FECT.R

generates parallel trend tests from FEct estimation (figures 3A-2, 3B-2 and 3C-2  - manuscript) using DIDmatching_BZ10m_GFC.dta


4.3. ###### robustness checks using new TMF deforestation data: FECT.R

generates parallel trend tests from FEct estimation (figures 4A-2, 4B-2 and 4C-2 - manuscript) using DIDmatching_TMF.dta

5 ####################### FIGURE DEFORESTATION TRENDS #############################

5.1. ###### main analysis: figures_GFC.do

- generates figures using DID_BZ20km_GFC.dta and DIDmatching_BZ20km_GFC.dta showing deforestation trends of unprotected areas, PA size reductions, constant size PA and their corresponding match (figure 6A, 6B and 6C  - manuscript).


5.2. ###### robustness checks exluding a 10km BZ: figures_GFC_BZ10.do

- generates the same figures using DID_BZ10km_GFC.dta and DIDmatching_BZ10km_GFC.dta (figures 3A-1, 3B-1 and 3C-1 - supplementary materials).


5.3. ###### robustness checks using new TMF deforestation data: figures_TMF.do 

- generates the same figures using DID_TMF.dta and DIDmatching_TMF.dta (figures 4A-1, 4B-1 and 4C-1   - supplementary materials).


6 ####################### OTHER FIGURES #############################

figure1_2.do

- prepare PA and PADDD data, draw figure 1 of the manuscript
- draw 2 of the manuscript from PRODES deforestation data.


